<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ (c) 2018 Open Source Geospatial Foundation - all rights reserved
  ~ This code is licensed under the GPL 2.0 license, available at the root
  ~ application directory.
  ~
  -->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:sec="http://www.springframework.org/schema/security" xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/security
          http://www.springframework.org/schema/security/spring-security-3.0.4.xsd
          http://www.springframework.org/schema/security/oauth2
          http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd">

	<bean id="googleOauth2Extension" class="org.geoserver.platform.ModuleStatusImpl">
		<constructor-arg index="0" value="gs-sec-oauth2-google" />
		<constructor-arg index="1" value="GeoServer Security OAuth2 Google" />
	</bean>

	<!-- OAuth2 Security Extension -->
	<bean id="googleOAuth2TokenServices"
		class="org.geoserver.security.oauth2.services.GoogleTokenServices">
	</bean>

	<bean id="googleOAuth2AuthenticationProvider"
		class="org.geoserver.security.oauth2.GoogleOAuth2AuthenticationProvider">
		<constructor-arg ref="authenticationManager" />
		<constructor-arg value="googleOAuth2TokenServices" />
		<constructor-arg value="googleOAuth2SecurityConfiguration" />
		<constructor-arg value="googleOauth2RestTemplate" />
	</bean>

	<!-- ui auth provider panel info -->
	<bean id="googleOAuth2AuthPanelInfo"
		class="org.geoserver.web.security.oauth2.GoogleOAuth2AuthProviderPanelInfo">
		<property name="id" value="security.GoogleOAuth2AuthProvider" />
		<property name="shortTitleKey" value="GoogleOAuth2AuthProviderPanel.short" />
		<property name="titleKey" value="GoogleOAuth2AuthProviderPanel.title" />
		<property name="descriptionKey" value="GoogleOAuth2AuthProviderPanel.description" />
	</bean>

	<!-- login button -->
 	<bean id="googleFormLoginButton" class="org.geoserver.web.LoginFormInfo">
 		<property name="id" value="googleFormLoginButton" />
 		<property name="titleKey" value="" />
 		<property name="descriptionKey" value="GoogleOAuth2AuthProviderPanel.description" />
 		<property name="componentClass" value="org.geoserver.web.security.oauth2.GoogleOAuth2AuthProviderPanel" />
 		<property name="name" value="google" />
 		<property name="icon" value="google.png" />
 		<property name="filterClass" value="org.geoserver.security.oauth2.GoogleOAuthAuthenticationFilter" />
 		<property name="loginPath" value="web/j_spring_oauth2_google_login" />
 	</bean>

</beans>
